// 简化的响应式工具类
export class ResponsiveUtils {
  static instance: ResponsiveUtils
  scene: Phaser.Scene | null = null

  static getInstance(): ResponsiveUtils {
    if (!ResponsiveUtils.instance) {
      ResponsiveUtils.instance = new ResponsiveUtils()
    }
    return ResponsiveUtils.instance
  }

  // 初始化
  init(scene: Phaser.Scene) {
    this.scene = scene
    console.log('ResponsiveUtils initialized')
  }

  // 获取当前缩放比例（基于Phaser的自动缩放）
  getScale(): number {
    if (!this.scene) return 1
    return this.scene.scale.displayScale.x
  }

  // 获取屏幕尺寸
  getScreenSize(): { width, height: number } {
    if (!this.scene) return { width: 1280, height: 720 }
    return {
      width: this.scene.scale.width,
      height: this.scene.scale.height
    }
  }

  // 获取响应式字体大小
  getResponsiveFontSize(baseFontSize): number {
    const scale = this.getScale()
    return Math.max(10, Math.round(baseFontSize * scale))
  }

  // 判断屏幕类型
  getLayoutMode(): 'desktop' | 'tablet' | 'mobile' {
    const { width } = this.getScreenSize()
    if (width >= 1024) return 'desktop'
    if (width >= 768) return 'tablet'
    return 'mobile'
  }

  // 应用全局缩放到场景 - 暂时禁用避免显示问题
  applyGlobalScale(scene: Phaser.Scene, targetScale?) {
    // 暂时禁用所有缩放操作
    console.log(`ResponsiveUtils: scaling disabled for debugging`)
    return
  }
}
